<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>

</h:head>

<h:body>
	<ui:composition template="./template.xhtml">
		<ui:define name="header">
			<title>Market Grabber - Inbox</title>
			<link rel="stylesheet" type="text/css" href="inboxstyle.css" />
		</ui:define>
		<ui:define name="siteheader">
                Inbox of #{user.name}
        </ui:define>
		<ui:define name="leftmenu">
			<c:if test="#{user.name == 'Requester'}">
				<li><h:link outcome="newOrder">Create New Order</h:link></li>
			</c:if>
			<li><h:form>
					<h:commandLink action="#{user.logout}">Logout</h:commandLink>
				</h:form></li>
		</ui:define>

		<ui:define name="maincontent">
			<h:form>
				<table>
					<thead>
						<tr>
							<th>Task Name</th>
							<th>Assignee</th>
							<th>Task ID</th>
							<th>Process Instance ID</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${user.assignedTasks}" var="task">
							<tr>
								<td>
									<h:commandLink action="#{activiti.redirectToTask(task.id)}">
										#{task.name}
										<f:setPropertyActionListener target="#{user.lastTaskId}" value="#{task.id}" />
										<f:setPropertyActionListener target="#{user.lastProcInstanceId}" value="#{task.processInstanceId}" />
									</h:commandLink>
								</td>
								<td>#{task.assignee}</td>
								<td>#{task.id}</td>
								<td>#{task.processInstanceId}</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>